package com.douxg.fastCoding.randomData;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.Random;

/**
 * @Description
 * @Auther douxg
 * @Date 2020/11/12 13:04
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
public class StringRandomData implements RandomData<String> {
    private int lenth = 6;
    private int start = 97;
    private int end = start + 25;

    @Override
    public String create() {
        StringBuilder sb = new StringBuilder();
        for (int i = 0; i < lenth; i++) {
            char a = (char) (new Random().nextInt(end - start) + start);
            sb.append(a);
        }
        return sb.toString();
    }
}
